﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="EmployeeSalesByCountryReport.aspx.cs" Inherits="ReportPages_AlphabeticalListOfProductsReport" %>

<%@ Register assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Employee Sales By Country Report</title>
    <style type="text/css">
        .style1
        {
            width: 167px;
        }
        .style2
        {
            width: 152px;
        }
        .style3
        {
            width: 121px;
        }
        .style4
        {
            width: 89px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>

        <a href="../Default.aspx">Home</a><br /><br /> 
        <table style="width:100%;">
            <tr>
                <td class="style1">
                    Date From (dd/mm/yyyy):</td>
                <td class="style3">
        <asp:TextBox ID="dateFromTextBox" runat="server" Width="58px">1/1/1997</asp:TextBox>
                </td>
                <td class="style2">
                    Date To (dd/mm/yyyy):</td>
                <td class="style4">
        <asp:TextBox ID="dateToTextBox" runat="server" Width="79px">1/1/1998</asp:TextBox>
                </td>
                <td>
                    <asp:Button ID="Button1" runat="server" Text="Refresh" Width="111px" 
                        onclick="Button1_Click" />
                </td>
            </tr>
        </table> 
        <br /><br />            
    </div>
        <rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" 
            Font-Size="8pt" Height="549px" Width="776px">
            <LocalReport ReportPath="Reports\EmployeeSalesByCountryReport.rdlc">
                <DataSources>
                    <rsweb:ReportDataSource DataSourceId="AccessDataSource1" 
                        Name="SimpleReportsDataSet_EmployeeSalesByCountryReport" />
                </DataSources>
            </LocalReport>
        </rsweb:ReportViewer>
        <asp:AccessDataSource ID="AccessDataSource1" runat="server" 
            DataFile="~/App_Data/NorthwindNET.mdb" 
            DeleteCommand="DELETE FROM `Shipper` WHERE `ID` = ?" 
            InsertCommand="INSERT INTO `Shipper` (`ID`, `Name`, `Phone`) VALUES (?, ?, ?)" 
            SelectCommand="SELECT Employee.Country, Employee.LastName, Employee.FirstName, [Order].ShippedDate, [Order].ID AS OrderID, OrderTotals.OrderTotal FROM (([Order] INNER JOIN (SELECT OrderID, SUM(CCur((UnitPrice * Quantity) * (1 - Discount) / 100) * 100) AS OrderTotal FROM OrderDetail GROUP BY OrderID) OrderTotals ON [Order].ID = OrderTotals.OrderID) INNER JOIN Employee ON [Order].EmployeeID = Employee.ID) WHERE ([Order].ShippedDate BETWEEN DateFrom AND DateTo)" 
            
            
            UpdateCommand="UPDATE `Shipper` SET `Name` = ?, `Phone` = ? WHERE `ID` = ?">
            <SelectParameters>
                <asp:ControlParameter ControlID="dateFromTextBox" Name="DateFrom" 
                    PropertyName="Text" />
                <asp:ControlParameter ControlID="dateToTextBox" Name="DateTo" 
                    PropertyName="Text" />
            </SelectParameters>
            <DeleteParameters>
                <asp:Parameter Name="ID" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="ID" Type="Int32" />
                <asp:Parameter Name="Name" Type="String" />
                <asp:Parameter Name="Phone" Type="String" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="Name" Type="String" />
                <asp:Parameter Name="Phone" Type="String" />
                <asp:Parameter Name="ID" Type="Int32" />
            </UpdateParameters>
        </asp:AccessDataSource>
    </form>
</body>
</html>
